New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
axis returns linuxcnc to MODE_MANUAL after each MDI command #361
Comments
I have been unable to find the commit that introduced this change, but I remember something about making axis return LinuxCNC to manual mode after an MDI. I believe this was to resolve the nuisance in 2.7 of having to first jog via the keyboard to set LinuxCNC to manual mode before a MPG could be used to jog. Returning to manual mode seems like desirable behavior in general. The problem is that it has broken at least one user plugin (right term?) probe_screen, which issues a series of MDI commands via the python interface and expects LinuxCNC to remain in MDI mode after each command has been executed. I have tried setting linuxcnc to MDI mode immediately before issuing each MDI command but that fails maybe 50% of the time. I guess axis is setting the mode back to manual between when the mode is set to MDI and when the MDI command is actualy issued. |
This crude script demonstrates that even if the mode it set to MDI immediately before issuing an MDI command, somehow either LinuxnCNC does not actually get set to MDI, or it gets set back to to manual between the time the scripts sets the mode to MDI and actual issues the MDI command. You might have to run this a couple times, but it should cause the error I hope I am just doing something stupid here, and there is an easy solution. #!/usr/bin/env python
import linuxcnc
s = linuxcnc.stat()
c = linuxcnc.command()
MODES = {
linuxcnc.MODE_MANUAL: 'MANUAL',
linuxcnc.MODE_AUTO : 'AUTO',
linuxcnc.MODE_MDI : 'MDI'
}
def print_mode():
s.poll()
print "Current MODE: ", MODES[s.task_mode]
print_mode()
for i in range(4):
print '\n'
print_mode()
print 'Changing to MDI mode ...'
c.mode(linuxcnc.MODE_MDI)
c.wait_complete()
print_mode()
cmd = 'G0 X{}'.format(i)
print 'Issuing MDI command: ', cmd
c.mdi(cmd)
c.wait_complete() |
As this happen also with gmoccapy, i think it is not related to the gui itself.NorbertAm 30.11.2017 21:39 schrieb Kurt Jacobson <notifications@github.com>:This crude script demonstrates that even if the mode it set to MDI immediately before issuing an MDI command, somehow either LinuxnCNC does not actually get set to MDI, or it gets set back to to manual between the time the scripts sets the mode to MDI and actual issues the MDI command.
You might have to run this a couple times, but it should cause the error Must be in MDI mode to issue MDI command to raise its ugly head.
I hope I am just doing something stupid here, and there is an easy solution.
#!/usr/bin/env python
import linuxcnc
s = linuxcnc.stat()
c = linuxcnc.command()
MODES = {
linuxcnc.MODE_MANUAL: 'MANUAL',
linuxcnc.MODE_AUTO : 'AUTO',
linuxcnc.MODE_MDI : 'MDI'
}
def print_mode():
s.poll()
print "Current MODE: ", MODES[s.task_mode]
print_mode()
for i in range(4):
print '\n'
print_mode()
print 'Changing to MDI mode ...'
c.mode(linuxcnc.MODE_MDI)
c.wait_complete()
print_mode()
cmd = 'G0 X{}'.format(i)
print 'Issuing MDI command: ', cmd
c.mdi(cmd)
c.wait_complete()
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.
|
That is interesting Norbert, I had not noticed it happening in Gmoccapy, I will test it again. I do think it is GUI dependent though as my little script behaves correctly when I run it using hazzy as the GUI. |
I had no possibility to test with your script, but probe-screen embedded in gmoccapy does also complain about not being in MDI mods.NorbertAm 30.11.2017 22:16 schrieb Kurt Jacobson <notifications@github.com>:That is interesting Norbert, I had not noticed it happening in Gmoccapy, I will test it again.
I do think it is GUI dependent though as my little script behaves correctly when I run it using hazzy as the GUI.
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.
|
OK, I made two quick videos showing the difference between running the scrip I posted above in axis and in hazzy. When run in hazzy it behaves as I would expect, stopping between each 1in segment due to the When I run the script in axis, the first segment seems to run correctly, but the second two segments are 'run together'. You can see this both from the rapid succession of prints in the terminal and the motion of the cone in the back-plot. Also, we get the I think this indicates that the problem is with the GUI, and not elsewhere. Here are links to the two videos: (Sorry for testing against hazzy, since it is not a standard UI, but I know how it works (I hope :D) so that was the easiest way for me to eliminate other possible causes.) |
I encountered this problem too, see #285 |
Thanks @pkmcnc, I saw your issue but I was not certain it was the same thing, now I am pretty sure it is. Sorry for the duplication. |
My description was not clear enough, probably. I'm kind of glad that you also found this issue. It's pretty annoying, because I have a blocking relay connected to manual mode pin (inverted, actually), and it goes on/off when the machine starts, when MDI tab is selected, also before and after every MDI command. |
@gmoccapy I don't know how good of a test my little script is, but I just tested Gmoccapy with it and everything seems to work as expected. When I get a chance I will test Gmoccay with probe_screen. |
Good news: I think I found the commit that breaks it. |
Hmm, maybe this is an axis bug? |
fix from @dngarrett 3de8778 |
I think this can be closed. |
@rene-dev closing per your note. Thanks @dngarrett |
I have Meet the same problem,How can I solve this problem? thank you |
Here are the steps I follow to reproduce the issue:
This is what I expected to happen:
I expect LinuxCNC to remain in MDI mode until the mode is changed via
c.mode()
, or by some interaction with the UI.This is what happened instead:
It appears that axis is setting LinuxCNC to manual mode whenever the interpreter becomes idle, which causes subsequent MDI commands to fail.
It worked properly before this:
Works as expected in 2.7.11, i.e. LinuxCNC remains in MDI mode so that multiple MDI commands can be issued in succession without having to set MDI mode before each command.
Information about my hardware and software:
The text was updated successfully, but these errors were encountered: